package com.example.ai.embedding;

import org.springframework.ai.reader.JsonMetadataGenerator;

import java.util.Map;

public class MyJsonMetadataGenerator implements JsonMetadataGenerator {
    @Override
    public Map<String, Object> generate(Map<String, Object> jsonMap) {
        Object metadataObj = jsonMap.get("metadata");
        if (metadataObj instanceof Map metadata) {
            return Map.of("author",metadata.get("author"),
                    "price",metadata.get("price"));
        }
        return Map.of();
    }
}
